#使用类的方式实现栈和队列
class stack:
    def __init__ (self):
        self.data=[]
    def push (self,x):
        self.data.append(x)
    def pop (self):
        return self.data.pop()
a=stack()
a.push(1)
a.push(56)
a.push('g')
print(a.pop())
print(a.pop())
print(a.pop())


#
class Queue:
    def __init__ (self):
        self.item=[]
    def enqueue(self,x):
        self.item.insert(0,x)
    def dequeue(self):
        return self.item.pop()
a=Queue()
a.enqueue(23)
a.enqueue(78)
a.enqueue('cat')
print(a.dequeue())
print(a.dequeue())
print(a.dequeue())
        
    